package hung.vnptthanhhoa.adapter;

import hung.vnptthanhhoa.cookingbook.Fragment_Cooking;
import hung.vnptthanhhoa.cookingbook.Fragment_Food_Detail;
import hung.vnptthanhhoa.cookingbook.R;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTransaction;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

public class RootFragment extends Fragment {

	private static final String TAG = "RootFragment";
	private String key = "";

	public RootFragment(String key) {
		this.key = key;
	}

	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {
		/* Inflate the layout for this fragment */
		View view = inflater.inflate(R.layout.root_fragment, container, false);

		FragmentTransaction transaction = getFragmentManager()
				.beginTransaction();
		/*
		 * When this container fragment is created, we fill it with our first
		 * "real" fragment
		 */
		if (key == "fragment_cooking")
			transaction.replace(R.id.root_frame, new Fragment_Cooking());
//		else if (key == "fragment_food_detail")
//			transaction.replace(R.id.root_frame, new Fragment_Food_Detail());
		transaction.commit();

		return view;
	}
}